//pages数组中第一项表示应用启动页，参考：https://uniapp.dcloud.io/collocation/pages
// const pages = [...require('./modules/index.ts'), ...require('./modules/demo.ts')]
const fs = require('fs')

const firstPage = 'pages/index/index'

const pages = [
	{
		path: firstPage,
		style: {
			navigationBarTitleText: '首页',
			navigationStyle: 'custom'
		}
	}
]

fs.readdirSync('./src/pages_config/modules').forEach((file) => {
	const filePath = './modules' + '/' + file
	const fileContent = require(filePath)
	fileContent.forEach((page) => {
		if (page.path !== firstPage) {
			pages.push(page)
		}
	})
})

module.exports = {
	pages,
	// 可以继续分离其他配置
	globalStyle: {
		navigationBarTextStyle: 'black',
		navigationBarTitleText: 'uni-app',
		navigationBarBackgroundColor: '#60A5FA',
		backgroundColor: '#F8F8F8'
	},
	tabBar: {
		color: '#C5C5CD',
		selectedColor: '#F84B3C',
		borderStyle: 'black',
		backgroundColor: '#ffffff',
		list: [
			{
				pagePath: 'pages/index/index',
				text: '首页',
				iconPath: 'static/images/tabBar/home.png',
				selectedIconPath: 'static/images/tabBar/home_cur.png'
			},
			{
				pagePath: 'pages/user/center/Index',
				text: '我的',
				iconPath: 'static/images/tabBar/me.png',
				selectedIconPath: 'static/images/tabBar/me_cur.png'
			}
		]
	},
	easycom: {
		autoscan: true,
		custom: {
			'^uni-(.*)': '@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue',
			'^u--(.*)': 'uview-plus/components/u-$1/u-$1.vue',
			'^up-(.*)': 'uview-plus/components/u-$1/u-$1.vue',
			'^uv-(.*)': 'uview-plus/components/u-$1/u-$1.vue',
			'^u-([^-].*)': 'uview-plus/components/u-$1/u-$1.vue'
		}
	}
}
